﻿using Newtonsoft.Json;
namespace Business.Entities.Actions
{
    /// <summary>
    /// Class representing an action request to google tasks
    /// </summary>
    public class GoogleAction
    {
        /// <summary>
        /// Occurs when result is received after execution of action
        /// </summary>
        public event ResultEventHandler ResultReceived;

        public string action_type;
        public string action_id;
        public string id;
        public string source_list;
        public string dest_parent;
        public string dest_list;
        public string list_id;
        public string parent_id;
        public string dest_parent_type;
        public string prior_sibling_id;
        public string current_list_id;
        public int index;
        public bool get_deleted; 
        public EntityDelta entity_delta;

        [JsonIgnore]
        public bool IsDeleteListAction;
        /// <summary>
        /// Call this to invoke ResultHandler
        /// </summary>
        /// <param name="result"></param>
        public void ResultRetrieved(Result result)
        {
            if (ResultReceived != null) ResultReceived.Invoke(result);
        }
    }

    public delegate void ResultEventHandler(Result result);
}
